import { _decorator, Component, Node } from "cc";
import { speed } from "./Contanst";
const { ccclass, property } = _decorator;

@ccclass("Pipe")
export class Pipe extends Component {
  @property
  public moveSpeed = speed;

  protected start() {}

  protected update(deltaTime: number) {
    this.node.setPosition(
      this.node.position.x - this.moveSpeed * deltaTime,
      this.node.position.y
    );
    if (this.node.position.x <= -900) {
      this.node.destroy();
    }
  }
}
